<?php

namespace app\models;

use Yii;
use yii\db\ActiveRecord;
use yii\behaviors\TimestampBehavior;
/**
 * This is the model class for table "{{%wm_active}}".
 *
 * @property integer $id
 * @property string $times
 * @property integer $pid
 * @property integer $num
 * @property integer $created_at
 */
class WmActive extends \yii\db\ActiveRecord
{

    public function behaviors()
    {
        return [
            'timestamp' => [
                'class' => TimestampBehavior::className(),
                'attributes' => [
                    ActiveRecord::EVENT_BEFORE_INSERT => 'created_at',
//                    ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at',
                ]
                //'value' => function() { return date('U'); // unix timestamp },
            ]
        ];
    }
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%wm_active}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['pid','times'], 'required'],
            [['times'], 'safe'],
            [['pid', 'num', 'created_at'], 'integer'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'times' => Yii::t('app', 'Times'),
            'pid' => Yii::t('app', 'Pid'),
            'num' => Yii::t('app', 'Num'),
            'created_at' => Yii::t('app', 'Created At'),
        ];
    }
}
